Introduction
Aida itself support Central REST Principle from the start (Wikipedia): "An important concept in REST is the existence of resources (sources of specific information), each of which is referenced with a global identifier (e.g., a URI in HTTP).
Resource is a domain object in Aida while representation is a Web page made by domain object's App, as a subclass of a WebApplication.
But you can present your domain object differently simply by adding a desired format at the end of URL and implement an appropriate #as method in domain object. Example for a Person class :
- http://my.server.org/person/stefi will be presented as HTML with class PersonApp
- http://my.server.org/person/stefi.json aPerson asJson
- http://my.server.org/person/stefi.xml aPerson asXml
Implementation
A notion of presenters is introduced in Aida 6.5. Default HTML presenters are App subclasses of WebApplication, while there are new WebJSONPresenter and WebXMLPresenter classes, so far for those two presentations. They simply call domain object #asJson or #asXml for now. Later subclassing of those presenters will be possible, named by convention on domain classes similar to current Apps for HTML presentation.
Later also more REST-like operations will be introduced, like PUT, DELETE, POST etc.
Further reading